package com.sojoys.artifact.tools;

public class SK_Exception extends Exception {
	private static final long serialVersionUID = 1L;
	private int code;
	private String msg;
	private int type = 0;

	public SK_Exception(int code) {
		this.code = code;
		this.type = 0;
	}

	public SK_Exception(int code, String msg) {
		this.code = code;
		this.msg = msg;
		this.type = 1;
	}

	public SK_Exception(String msg) {
		this.msg = msg;
		this.type = 2;
	}

	@Override
	public String getMessage() {
		switch (type) {
		case 0:
			return SK_Plus.b("Code --> ", code).e();
		case 1:
			return SK_Plus.b("Code --> ", code, " ErrorInfo : ",msg ).e();
		case 2:
			return SK_Plus.b("ErrorInfo --> ",msg != null ? msg : "").e();
		default:
			return super.getMessage();	
		}

	}

	public int getCode() {
		return code;
	}
}
